gtk_tests += [['testerrors']]
endif
-# TODO: need to pass source dir so progs can find .ui files and such
-# (with autotools this only works in the builddir == srcdir case)
+# Pass the source dir here so programs can change into the source directory
+# and find .ui files and .png files and such that they load at runtime
+test_args = ['-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())]
+
foreach t : gtk_tests
test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name), t.get(1, [])]
- executable(test_name, test_srcs, dependencies: [libgtk_dep, libm])
+ executable(test_name, test_srcs,
+ c_args : test_args,
+ dependencies : [libgtk_dep, libm])
endforeach
subdir('visuals')
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
static void
show_message_dialog1 (GtkWindow *parent)
GtkWidget *box;
GtkWidget *button;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
*/
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
int
main (int argc,
GEmblem *emblem;
gchar *str;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
pixbuf = gdk_pixbuf_new_from_file ("apple-red.png", NULL);
#include <unistd.h>
#endif
+#include <glib/gstdio.h>
+
#include "gtk/gtk.h"
#include "gdk/gdk.h"
#include "gdk/gdkkeysyms.h"
g_set_application_name ("GTK+ Test Program");
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
provider = gtk_css_provider_new ();
*/
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
#include <sys/types.h>
#include <string.h>
GtkCellRenderer *cell;
GtkTreeViewColumn *tvc;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
/* to test rtl layout, set RTL=1 in the environment */
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
static void
activate (GSimpleAction *action,
GtkWidget *check;
GtkWidget *combo;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
typedef struct {
GtkListBoxRow parent;
GSimpleActionGroup *group;
GSimpleAction *action;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
builder = gtk_builder_new_from_file ("selectionmode.ui");
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
static void
split_decorations (GtkSettings *settings,
GtkWidget *check;
GtkWidget *header;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
builder = gtk_builder_new_from_file ("testsplitheaders.ui");
#include <gtk/gtk.h>
+#include <glib/gstdio.h>
static GtkWidget *header_stack;
static GtkWidget *page_stack;
GtkBuilder *builder;
GtkWidget *win;
+#ifdef GTK_SRCDIR
+ g_chdir (GTK_SRCDIR);
+#endif
+
gtk_init ();
builder = gtk_builder_new ();